<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('BOM选择页')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>品号：</label>
                            <input type="text" id = "itemNo" name="itemNo"/>
                        </li>
                        <li>
                            <label>品名：</label>
                            <input type="text" id = "itemName" name="itemName"/>
                        </li>
                        <li>
                            <label>规格：</label>
                            <input type="text" id="itemSp" name="itemSp"/>
                        </li>
                        <li>
                            <label>项目号：</label>
                            <input type="text" id="projectNo" name="projectNo"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;查询</a>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="selectRadioBom()">&nbsp;确定</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <!--<div class="select-list">
                <ul>
                    <li>
                        <a class="btn btn-primary btn-sm" onclick="selectRadioBom()">&nbsp;确定</a>
                    </li>
                </ul>
            </div>-->
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "bom";
    // var datas = [[${@dict.getType('sys_normal_disable')}]];

    $(function() {
        var options = {
            url: prefix + "/bomList",
            // showSearch: false,
            // showRefresh: false,
            // showToggle: false,
            // showColumns: false,
            columns: [{
                radio: true
            },
                {
                    field : 'f_000073',
                    title : '项目号'
                },
                {
                    field : 'id',
                    title : 'BOM品号'
                },
                {
                    field : 'name',
                    title : '品名'
                },
                {
                    field : 'specification',
                    title : '规格'
                },
                {
                    field : 'revisionid',
                    title : '版本'
                },
                {
                    field : 'status',
                    title : '状态'
                },
                {
                    field : 'createuser',
                    title : '创建人'
                },
                {
                    field : 'createtime',
                    title : '创建日'
                }

                ]
        };
        $.table.init(options);
    });

    // 打开物料界面
    function selectRadioBom(){
        var data = $("#" + table.options.id).bootstrapTable('getSelections');
        if (Array.isArray(data) && data.length === 0){
            $.modal.alertError('请选择BOM')
        }else {
            $.modal.open("物料信息", prefix + "/openItem", '1500', '1100',{
                ItemNo: data
            });
        }
    }
</script>
</body>
</html>